$(function(){
	var index = 0 , size , adTimer;
	size = $(".num > li").length;
	$(".num li").mouseover(function(){
		index =$(".num li").index(this);
		showImage(index);
	}).eq(0).mouseover();
	//
	$(".ad_box").hover(function() {
		clearInterval(adTimer);
	}, function() {
		adTimer = setInterval(function(){
			showImage(index);
			index ++;
			if( index == size ){
				index = 0;
			}
		} , 2000);
	}).trigger("mouseleave");
	
	//tabs
	// setup ul.tabs to work as tabs for each div directly under div.panes 
    $(".will_content ul.tabs").tabs("div.panes > div"); 
});

function showImage(index){
	var adHeight = $(".ad_box").height();
	$(".ad_box .slider").stop(true,false).animate({top:-adHeight*index}, 1000);
	$(".num li").removeClass("moveon").eq(index).addClass("moveon");
}
